//
//  DaMaoMall+ReactiveExtension.h
//  DaMaoMall
//
//  Created by HXHL-wally on 16/8/1.
//  Copyright © 2016年 daMao-wally. All rights reserved.
//

#import "DMBaseAPIManager.h"
#import "DMPageAPIManager.h"
#import <ReactiveCocoa/ReactiveCocoa.h>



@protocol DMNetworkingRACOperationProtocol<NSObject>
- (RACCommand *)cancelCommand;
- (RACSignal *)requestErrorSignal;
- (RACSignal *)executionSignal;
@end

@protocol DMNetworkingListRACOperationProtocol<DMNetworkingRACOperationProtocol>
- (RACCommand *)refreshCommand;
- (RACCommand *)requestNextPageCommand;
@end

@protocol DMNetworkingRACProtocol <NSObject>

@optional
- (id<DMNetworkingRACOperationProtocol>)networkingRAC;
// 定义枚举在这允许获取多个APIManager的RAC
- (NSArray<id<DMNetworkingRACOperationProtocol>>*)networkingRACs;
@end


@protocol DMNetworkingListRACProtocol <NSObject>
@required
- (id<DMNetworkingListRACOperationProtocol>)networkingRAC;
@end


@interface DMBaseAPIManager (ReactiveExtension)<DMNetworkingRACOperationProtocol>
@property (nonatomic, strong, readonly) RACCommand *requestCommand;
@property (nonatomic, strong, readonly) RACCommand *cancelCommand;
@property (nonatomic, strong, readonly) RACSignal *requestErrorSignal; //已为主线程
@property (nonatomic, strong, readonly) RACSignal *executionSignal;

- (RACSignal *)requestSignal;
@end

@interface DMPageAPIManager (ReactiveExtension)<DMNetworkingListRACOperationProtocol>
@property (nonatomic, strong, readonly) RACCommand *refreshCommand;
@property (nonatomic, strong, readonly) RACCommand *requestNextPageCommand;
@end


